import React, { Component } from 'react';
import { Switch, Route } from 'react-router-dom'
import Beforeeach from './BeforeEach';
class Routerview extends Component {
	render() {
		const { routes } = this.props
		return (
			<Switch>
				{
					routes.length > 0 && routes.map((v, i) => {
						return (
							<Route exact={ v.exact } key={i} path={v.path} render={props => <Beforeeach {...props} routes={v.children} { ...v }></Beforeeach>}></Route>
						)
					})
				}
			</Switch>
		);
	}
}

export default Routerview;
